package cz.vargagab.server;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * http://www.java-tips.org/java-ee-tips/java-servlet/how-to-work-with-servletcontextlistener.html
 * @author Gabriel Varga
 *
 */
public  class MyListener implements ServletContextListener {
  
  private ServletContext context = null;

  /*This method is invoked when the Web Application has been removed 
  and is no longer able to accept requests
  */

  public void contextDestroyed(ServletContextEvent event)
  {
    //Output a simple message to the server's console
    System.out.println("RMI Server Has Been Removed");
    this.context = null;
  }


  //This method is invoked when the Web Application
  //is ready to service requests

  public void contextInitialized(ServletContextEvent event)
  {
    this.context = event.getServletContext();
    System.out.println("RMI Server Is Ready");
  }
}